package com.cpecc.liucheng.controller;

import com.cpecc.manager.wuzi.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.wisteria.framework.web.APIResult;

import javax.annotation.Resource;

@Controller
@RequestMapping(value = "/process")
public class ProcessController {

    @Resource
    private BaoFeiManager baoFeiManager;

    @Resource
    private ShenQingManager shenQingManager;

    @Resource
    private YiJiaoManager yiJiaoManager;

    @Resource
    private WeiXiuManager weiXiuManager;

    @Resource
    private TuiHuoManager tuiHuoManager;

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ResponseBody
    public APIResult<Boolean> delete(@RequestParam(name = "type") String type, @RequestParam(name = "id") String id) {
        boolean result = false;
        if ("baofei".equals(type)) {
            result = baoFeiManager.delete(id);
        } else if ("shenqing".equals(type)) {
            result = shenQingManager.delete(id);
        } else if ("yijiao".equals(type)) {
            result = yiJiaoManager.delete(id);
        } else if ("weixiu".equals(type)) {
            result = weiXiuManager.delete(id);
        } else if ("tuihui".equals(type)) {
            result = yiJiaoManager.delete(id);
        }
        return APIResult.success(result);
    }
}
